home *** CD-ROM | disk | FTP | other *** search
/ Cream of the Crop 26 / Cream of the Crop 26.iso / os2 / octa209s.zip / octave-2.09 / liboctave / dColVector.h < prev    next >
C/C++ Source or Header  |  1997-03-07  |  3KB  |  113 lines

  1. /*
  2.  
  3. Copyright (C) 1996 John W. Eaton
  4.  
  5. This file is part of Octave.
  6.  
  7. Octave is free software; you can redistribute it and/or modify it
  8. under the terms of the GNU General Public License as published by the
  9. Free Software Foundation; either version 2, or (at your option) any
  10. later version.
  11.  
  12. Octave is distributed in the hope that it will be useful, but WITHOUT
  13. ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  14. FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  15. for more details.
  16.  
  17. You should have received a copy of the GNU General Public License
  18. along with Octave; see the file COPYING.  If not, write to the Free
  19. Software Foundation, 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
  20.  
  21. */
  22.  
  23. #if !defined (octave_ColumnVector_h)
  24. #define octave_ColumnVector_h 1
  25.  
  26. #if defined (__GNUG__)
  27. #pragma interface
  28. #endif
  29.  
  30. #include "MArray.h"
  31.  
  32. #include "mx-defs.h"
  33.  
  34. class ColumnVector : public MArray<double>
  35. {
  36. friend class Matrix;
  37. friend class RowVector;
  38.  
  39. public:
  40.  
  41.   ColumnVector (void) : MArray<double> () { }
  42.   ColumnVector (int n) : MArray<double> (n) { }
  43.   ColumnVector (int n, double val) : MArray<double> (n, val) { }
  44.   ColumnVector (const MArray<double>& a) : MArray<double> (a) { }
  45.   ColumnVector (const ColumnVector& a) : MArray<double> (a) { }
  46.  
  47.   ColumnVector& operator = (const ColumnVector& a)
  48.     {
  49.       MArray<double>::operator = (a);
  50.       return *this;
  51.     }
  52.  
  53.   bool operator == (const ColumnVector& a) const;
  54.   bool operator != (const ColumnVector& a) const;
  55.  
  56.   // destructive insert/delete/reorder operations
  57.  
  58.   ColumnVector& insert (const ColumnVector& a, int r);
  59.  
  60.   ColumnVector& fill (double val);
  61.   ColumnVector& fill (double val, int r1, int r2);
  62.  
  63.   ColumnVector stack (const ColumnVector& a) const;
  64.  
  65.   RowVector transpose (void) const;
  66.  
  67.   friend ColumnVector real (const ComplexColumnVector& a);
  68.   friend ColumnVector imag (const ComplexColumnVector& a);
  69.  
  70.   // resize is the destructive equivalent for this one
  71.  
  72.   ColumnVector extract (int r1, int r2) const;
  73.  
  74.   // column vector by column vector -> column vector operations
  75.  
  76.   ColumnVector& operator += (const ColumnVector& a);
  77.   ColumnVector& operator -= (const ColumnVector& a);
  78.  
  79.   // matrix by column vector -> column vector operations
  80.  
  81.   friend ColumnVector operator * (const Matrix& a, const ColumnVector& b);
  82.  
  83.   // diagonal matrix by column vector -> column vector operations
  84.  
  85.   friend ColumnVector operator * (const DiagMatrix& a, const ColumnVector& b);
  86.  
  87.   // other operations
  88.  
  89.   ColumnVector map (d_d_Mapper f) const;
  90.  
  91.   ColumnVector& apply (d_d_Mapper f);
  92.  
  93.   double min (void) const;
  94.   double max (void) const;
  95.  
  96.   // i/o
  97.  
  98.   friend ostream& operator << (ostream& os, const ColumnVector& a);
  99.   friend istream& operator >> (istream& is, ColumnVector& a);
  100.  
  101. private:
  102.  
  103.   ColumnVector (double *d, int l) : MArray<double> (d, l) { }
  104. };
  105.  
  106. #endif
  107.  
  108. /*
  109. ;;; Local Variables: ***
  110. ;;; mode: C++ ***
  111. ;;; End: ***
  112. */
  113.